package cn.z2huo.knowledge.concurrency.synchronizedkeyword.reentrant;

/**
 * <p>
 *
 * @author z2huo
 */
class ParentChildTest {

    class Parent {
        public synchronized void parentMethod() {
            System.out.println("Parent Method");
        }
    }

    class Child extends Parent {
        public synchronized void childMethod() {
            System.out.println("Child Method");
            super.parentMethod();
        }
    }

    public void test() {
        Child child = new Child();
        child.childMethod();
    }

    public static void main(String[] args) {
        ParentChildTest parentChildTest = new ParentChildTest();
        parentChildTest.test();
    }

}
